#!/usr/bin/perl

use lib qw( lib );
use DateTime::Event::Predict;

use Data::Dumper;

my $dtp = new DateTime::Event::Predict;

#warn Dumper($dt);

my @months = (1 .. 12);
my @days   = (1 .. 30);

my @md = ();
for (1 .. 100) {
	push(@md, [ $months[rand $#months], $days[rand $#days] ]);
}

#$Data::Dumper::Indent = 0;
#warn Dumper(\@md); exit;

#my $dates = [[4,21],[10,12],[6,29],[11,13],[11,24],[8,18],[2,26],[2,13],[10,4],[7,1],[2,17],[1,2],[3,21],[9,10],[11,20],[5,10],[1,5],[3,3],[2,21],[11,1],[9,23],[2,16],[3,10],[8,3],[2,19],[11,9],[5,21],[8,22],[11,24],[1,16],[11,9],[10,15],[9,5],[1,14],[8,4],[8,17],[4,27],[11,3],[5,14],[5,7],[10,14],[1,17],[1,8],[2,16],[2,19],[5,19],[5,27],[6,28],[6,1],[3,17],[9,27],[7,6],[8,29],[8,27],[8,1],[10,5],[1,15],[7,8],[6,25],[2,25],[5,1],[10,8],[9,11],[11,8],[7,26],[3,18],[2,4],[4,5],[10,15],[11,3],[4,9],[2,19],[11,13],[4,5],[5,20],[2,15],[3,1],[6,3],[9,5],[11,3],[6,29],[9,9],[10,9],[9,22],[11,24],[7,18],[6,2],[9,3],[8,9],[6,22],[3,27],[11,3],[6,4],[5,3],[10,19],[9,7],[8,23],[10,25],[4,3],[8,23]];
#my $dates = [[10, 1],[10, 2],[10, 3],[10, 4],[10, 5],[10, 6],[10, 7],[10, 8],[10, 9],[10, 10]];
#my $dates = [[9,30],[10, 1],[10, 3],[10, 7],[10, 10],[10, 14],[10, 18],[10, 23],[10, 29]];
#my $dates = [[9,30],[10, 1],[10, 2],[10, 3],[10, 4],[10, 5],[10, 6],[10, 7],[10, 8],[10, 9],[10, 10],[10, 11],[10, 12],[10, 13]];
#my $dates = [[10, 2],[10, 4],[10, 6],[10, 8],[10, 10],[10, 12],[10, 14],[10, 16],[10, 18],[10, 20],[10, 22],[10, 24],[10,30]];
my $dates = [[10, 2],[10, 4],[10, 6],[10, 8],[10, 10],[10, 12],[10, 14],[10, 16],[10, 18],[10, 20],[10, 22],[10, 24],[10,31]];

#for (1 .. 15) {
foreach my $date (@$dates) {
	my $dt = DateTime->new(
		year   => 2008,
		#month  => $months[rand $#months],
		#day    => $days[rand $#days],
		month  => $date->[0],
		day    => $date->[1],
	);
	                        
	$dtp->add_date($dt);
}

#warn Dumper($dtp);

#my $prediction = $dtp->predict;

#warn Dumper($dtp->{interval_buckets});
#warn Dumper($dtp->dates);

$dtp->train();
$dtp->print_dates();
print "NEXT: \n";
#$dtp->poisson_predict_days();
$dtp->regress_predict_days();
#$dtp->average_predict_days();

#warn Dumper($dtp);

#$dtp->poisson_predict();
